// pages/aboutMe/aboutMe.js
import { request } from "../../request/request";
Page({

  /**
   * 页面的初始数据
   */
  data: {
    //个人信息
    qq: '875708765',
    github: '',
    gitee: '',
    csdn: '',
    swiperList: [{
      id: 0,
      type: 'image',
      url: 'http://dcmd.oss-cn-beijing.aliyuncs.com/blog/images/swipe/swipe1.png'
    }, {
      id: 1,
        type: 'image',
        url: 'http://dcmd.oss-cn-beijing.aliyuncs.com/blog/images/swipe/swipe2.png',
    }, {
      id: 2,
      type: 'image',
      url: 'http://dcmd.oss-cn-beijing.aliyuncs.com/blog/images/swipe/swipe3.png'
    }, {
      id: 3,
      type: 'image',
      url: 'http://dcmd.oss-cn-beijing.aliyuncs.com/blog/images/swipe/swipe4.png'
    }, {
      id: 4,
      type: 'image',
      url: 'http://dcmd.oss-cn-beijing.aliyuncs.com/blog/images/swipe/swipe5.png'
    }],
  },

  // cardSwiper
  cardSwiper(e) {
    this.setData({
      cardCur: e.detail.current
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getPersonalInfo();
  },
  //获取个人信息数据
  async getPersonalInfo() {
    const res = await request({
      url: '/personal-info/getPersonalInfo'
    })
    if(res.code === 2000) {
      this.setData({
        qq: res.data.personalInfo.qq,
        github: res.data.personalInfo.github,
        gitee: res.data.personalInfo.gitee,
        csdn: res.data.personalInfo.csdn
      })
    }
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})